
package JET.Frames.recorderframe;

import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;


/**
 *
 * @author 057Ry
 */
public class RecCgartPanelMouseMotionListener implements MouseMotionListener
{
    RecorderChartPanel rcp;
    int lastX = 0;
    int lastY = 0;
    int moveX = 0;
    int moveY = 0;


    public RecCgartPanelMouseMotionListener(RecorderChartPanel rcp)
    {
        this.rcp = rcp;
    }
    public void mouseDragged(MouseEvent e) {
        moveX = e.getX() - lastX;
        moveY = e.getY() - lastY;
        lastX = e.getX();
        lastY = e.getY();

        rcp.vX += moveX;
        rcp.vY += moveY;
        rcp.repaint();
    }

    public void mouseMoved(MouseEvent e) 
    {
        moveX = e.getX() - lastX;
        moveY = e.getY() - lastY;
        lastX = e.getX();
        lastY = e.getY();

        System.out.println("screen: x:"+e.getX()+" y:"+e.getY());
        System.out.println(" graph: x:"+rcp.scrToGraphX(e.getX())+" y:"+rcp.scrToGraphY(e.getY()));
    }

}
